﻿<Canvas x:Class="PokemonBattleOnline.PBO.Battle.ControlPanel"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ui="clr-namespace:PokemonBattleOnline.PBO.Elements"
        xmlns:b="clr-namespace:PokemonBattleOnline.PBO.Battle"
        xmlns:c="clr-namespace:PokemonBattleOnline.PBO.Converters"
        Height="240" Width="320" SnapsToDevicePixels="True" UseLayoutRounding="True">
    <TabControl Height="240" Width="320" SnapsToDevicePixels="True" UseLayoutRounding="True" Name="controlPanel" SelectedIndex="{Binding SelectedPanel,Mode=TwoWay}" Background="{x:Null}" Padding="0,0,0,-2" TabStripPlacement="Bottom" BorderThickness="0" SelectionChanged="TabControl_SelectionChanged">
        <TabControl.Resources>
            <Style TargetType="TabItem">
                <Setter Property="Visibility" Value="Collapsed"/>
            </Style>
            <Style x:Key="ReturnButton" TargetType="b:GameButton">
                <EventSetter Event="Click" Handler="Return_Click"/>
                <Setter Property="Image" Value="/PBO;component/images/ControlPanel/Return.png"/>
                <Setter Property="Shape" Value="M3,47 A44,44 120 0 1 67,7 V47 Z"/>
                <Setter Property="Padding" Value="2,2,0,0"/>
                <Setter Property="Width" Value="67"/>
                <Setter Property="Height" Value="47"/>
                <Setter Property="HorizontalAlignment" Value="Right"/>
                <Setter Property="VerticalAlignment" Value="Bottom"/>
                <Setter Property="Canvas.Right" Value="0"/>
                <Setter Property="Canvas.Bottom" Value="0"/>
            </Style>
        </TabControl.Resources>
        <TabItem>
            <Image Height="240" Width="320" Source="/PBO;component/images/ControlPanel/BackgroundD.png"/>
        </TabItem>
        <TabItem>
            <Canvas>
                <Canvas.Background>
                    <ImageBrush ImageSource="/PBO;component/images/ControlPanel/MainMenu.png"/>
                </Canvas.Background>
                <b:GameButton Click="Fight_Click" Padding="2,1" Shape="M113,0 A113,70 180 1 1 113,140 A113,70 180 1 1 113,0 Z" Image="/PBO;component/images/ControlPanel/Fight.png" Width="226" Height="140" Canvas.Left="47" Canvas.Top="34"/>
                <Grid Width="320" Height="32" IsHitTestVisible="False" Canvas.Top="120">
                    <ListBox SelectedItem="{Binding ControllingPokemon.Pokemon,Mode=OneWay}" ItemsSource="{Binding OnboardPokemons}" ScrollViewer.VerticalScrollBarVisibility="Hidden" Background="{x:Null}" BorderBrush="{x:Null}" BorderThickness="0" Margin="-1" HorizontalAlignment="Center">
                        <ListBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel Orientation="Horizontal"/>
                            </ItemsPanelTemplate>
                        </ListBox.ItemsPanel>
                        <ListBox.ItemContainerStyle>
                            <Style TargetType="ListBoxItem">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="ListBoxItem">
                                            <Image Source="{TemplateBinding Content,Converter={x:Static c:SimPokemonIcon.C}}" SnapsToDevicePixels="True" Height="30" Width="40"/>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                                <Setter Property="Margin" Value="4,0"/>
                                <Setter Property="Opacity" Value="0.5"/>
                                <Style.Triggers>
                                    <Trigger Property="IsSelected" Value="True">
                                        <Setter Property="Opacity" Value="1"/>
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </ListBox.ItemContainerStyle>
                    </ListBox>
                </Grid>
                <b:GameButton Click="Pokemons_Click" Padding="1,1,0,0" Shape="M1,63 A58,58 120 0 1 90,11 V63 Z" Image="/PBO;component/images/ControlPanel/Pokemon.png" Width="90" Height="63" Canvas.Bottom="0" Canvas.Right="0"/>
                <b:GameButton Click="Run_Click" Padding="1,1,1,0" Shape="M0,50 A49,49 180 0 1 98,50 Z" Image="/PBO;component/images/ControlPanel/Run.png" Height="50" Width="98" Canvas.Bottom="0" Canvas.Left="110"/>
            </Canvas>
        </TabItem>
        <TabItem>
            <Grid>
                <Grid.Resources>
                    <Style x:Key="L" TargetType="b:GameButton">
                        <EventSetter Event="Click" Handler="Move_Click"/>
                        <Setter Property="Width" Value="158"/>
                        <Setter Property="Height" Value="58"/>
                        <Setter Property="HorizontalAlignment" Value="Left"/>
                        <Setter Property="VerticalAlignment" Value="Top"/>
                        <Setter Property="Image" Value="{Binding Content.Type.Type,Converter={x:Static c:BattleTypeMoveButton.C},RelativeSource={RelativeSource Self}}"/>
                        <Setter Property="Shape" Value="M0,0 H129 A29,29 180 1 1 129,58 H0 Z"/>
                        <Setter Property="Padding" Value="0,1,1,1"/>
                        <Setter Property="ContentTemplate">
                            <Setter.Value>
                                <DataTemplate>
                                    <Canvas>
                                        <Canvas.Resources>
                                            <Style TargetType="TextBlock">
                                                <Setter Property="FontSize" Value="15"/>
                                                <Setter Property="Foreground" Value="White"/>
                                                <Setter Property="Canvas.Top" Value="30"/>
                                            </Style>
                                        </Canvas.Resources>
                                        <Border Canvas.Top="9" Width="140">
                                            <TextBlock Text="{Binding Type.Id,Converter={x:Static c:MoveString.C}}" Foreground="Black" HorizontalAlignment="Center" SnapsToDevicePixels="True"/>
                                        </Border>
                                        <TextBlock Text="PP" Foreground="White" Canvas.Left="62"/>
                                        <TextBlock Text="{Binding PP.Value}" Foreground="White" Canvas.Right="50"/>
                                        <TextBlock Text="/" Foreground="White" Canvas.Left="113"/>
                                        <TextBlock Text="{Binding PP.Origin}" Foreground="White" Canvas.Left="120"/>
                                        <ContentControl Content="{Binding Type.Type}" ContentTemplate="{x:Static ui:Labels.BattleType}" Canvas.Left="1" Canvas.Top="31"/>
                                    </Canvas>
                                </DataTemplate>
                            </Setter.Value>
                        </Setter>
                        <Style.Triggers>
                            <Trigger Property="Content" Value="{x:Null}">
                                <Setter Property="Image" Value="/PBO;component/images/ControlPanel/Fight/Normal.png"/>
                                <Setter Property="IsEnabled" Value="False"/>
                                <Setter Property="ContentTemplate" Value="{x:Null}"/>
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                    <Style x:Key="R" TargetType="b:GameButton">
                        <EventSetter Event="Click" Handler="Move_Click"/>
                        <Setter Property="Width" Value="158"/>
                        <Setter Property="Height" Value="58"/>
                        <Setter Property="HorizontalAlignment" Value="Right"/>
                        <Setter Property="VerticalAlignment" Value="Top"/>
                        <Setter Property="Image" Value="{Binding Content.Type.Type,Converter={x:Static c:BattleTypeMoveButton.C},RelativeSource={RelativeSource Self}}"/>
                        <Setter Property="Shape" Value="M0,0 H129 A29,29 180 1 1 129,58 H0 Z"/>
                        <Setter Property="Padding" Value="1,1,0,1"/>
                        <Setter Property="HorizontalFlip" Value="True"/>
                        <Setter Property="ContentTemplate">
                            <Setter.Value>
                                <DataTemplate>
                                    <Canvas>
                                        <Canvas.Resources>
                                            <Style TargetType="TextBlock">
                                                <Setter Property="FontSize" Value="15"/>
                                                <Setter Property="Foreground" Value="White"/>
                                                <Setter Property="Canvas.Top" Value="30"/>
                                            </Style>
                                        </Canvas.Resources>
                                        <Border Canvas.Top="9" Width="140" Canvas.Right="0">
                                            <TextBlock Text="{Binding Type.Id,Converter={x:Static c:MoveString.C}}" Foreground="Black" HorizontalAlignment="Center" SnapsToDevicePixels="True"/>
                                        </Border>
                                        <TextBlock Text="PP" Canvas.Left="79"/>
                                        <TextBlock Text="{Binding PP.Value}" Canvas.Right="34"/>
                                        <TextBlock Text="/" Canvas.Left="129"/>
                                        <TextBlock Text="{Binding PP.Origin}" Canvas.Left="138"/>
                                        <ContentControl Content="{Binding Type.Type}" ContentTemplate="{x:Static ui:Labels.BattleType}" Canvas.Left="18" Canvas.Top="31"/>
                                    </Canvas>
                                </DataTemplate>
                            </Setter.Value>
                        </Setter>
                        <Style.Triggers>
                            <Trigger Property="Content" Value="{x:Null}">
                                <Setter Property="Image" Value="/PBO;component/images/ControlPanel/Fight/Normal.png"/>
                                <Setter Property="IsEnabled" Value="False"/>
                                <Setter Property="ContentTemplate" Value="{x:Null}"/>
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </Grid.Resources>
                <Grid.Style>
                    <Style TargetType="Grid">
                        <Setter Property="Background">
                            <Setter.Value>
                                <ImageBrush ImageSource="/PBO;component/images/ControlPanel/Fight/Background.png"/>
                            </Setter.Value>
                        </Setter>
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding Mega}" Value="True">
                                <Setter Property="Background">
                                    <Setter.Value>
                                        <ImageBrush ImageSource="/PBO;component/images/ControlPanel/Fight/BackgroundMega.png"/>
                                    </Setter.Value>
                                </Setter>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Grid.Style>
                <b:GameButton Style="{StaticResource ReturnButton}"/>
                <b:GameButton Content="{Binding ControllingPokemon.Moves[0]}" Style="{StaticResource L}" Margin="0,41,0,0"/>
                <b:GameButton Content="{Binding ControllingPokemon.Moves[1]}" Style="{StaticResource R}" Margin="0,41,0,0"/>
                <b:GameButton Content="{Binding ControllingPokemon.Moves[2]}" Style="{StaticResource L}" Margin="0,101,0,0"/>
                <b:GameButton Content="{Binding ControllingPokemon.Moves[3]}" Style="{StaticResource R}" Margin="0,101,0,0"/>
                <ToggleButton IsChecked="{Binding Mega}" Width="320" Height="108" Visibility="{Binding MegaVisibility}" HorizontalAlignment="Center" VerticalAlignment="Bottom">
                    <ToggleButton.Template>
                        <ControlTemplate TargetType="ToggleButton">
                            <Grid>
                                <Image Name="main" IsHitTestVisible="False" Source="/PBO;component/images/ControlPanel/Fight/MegaF.png"/>
                                <Ellipse Fill="Transparent" Margin="14,36,0,0" Width="114" Height="114" IsHitTestVisible="True"/>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsChecked" Value="True">
                                    <Setter TargetName="main" Property="Source" Value="/PBO;component/images/ControlPanel/Fight/MegaT.png"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </ToggleButton.Template>
                </ToggleButton>
            </Grid>
        </TabItem>
        <TabItem>
            <Canvas DataContext="{Binding TargetPanel}">
                <Canvas.Resources>
                    <Style x:Key="O" TargetType="b:GameButton">
                        <EventSetter Event="Click" Handler="Target_Click"/>
                        <Setter Property="Image" Value="/PBO;component/images/ControlPanel/Fight/Opponent.png"/>
                        <Setter Property="Shape" Value="M21.5,0 H53.5 A21.5,21.5 180 1 1 53.5,43 H21.5 A21.5,21.5 180 1 1 21.5,0Z"/>
                        <Setter Property="Padding" Value="2,1"/>
                        <Setter Property="Width" Value="75"/>
                        <Setter Property="Height" Value="43"/>
                        <Setter Property="Canvas.Top" Value="53"/>
                        <Setter Property="ContentTemplate">
                            <Setter.Value>
                                <DataTemplate>
                                    <Canvas DataContext="{Binding Pokemon}">
                                        <Rectangle RadiusX="5" RadiusY="5" Fill="#80000000" Width="100" Height="24" Canvas.Left="-15" Canvas.Top="-12"/>
                                        <TextBlock Text="{Binding Name}" FontSize="14" Foreground="#ffffff" Width="100" Canvas.Left="-15" Canvas.Top="-9"/>
                                        <ContentPresenter Content="{Binding Gender}" TextBlock.FontSize="14" ContentTemplate="{x:Static ui:Labels.Gender}" Canvas.Left="58" Canvas.Top="13"/>
                                        <Image Source="{Binding Converter={x:Static c:PokemonOutwardIcon.C}}" Height="30" Width="40" SnapsToDevicePixels="True" Canvas.Bottom="3" Canvas.Right="18"/>
                                    </Canvas>
                                </DataTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                    <Style x:Key="T" TargetType="b:GameButton">
                        <EventSetter Event="Click" Handler="Target_Click"/>
                        <Setter Property="Image" Value="/PBO;component/images/ControlPanel/Fight/Team.png"/>
                        <Setter Property="Shape" Value="M21.5,0 H53.5 A21.5,21.5 180 1 1 53.5,43 H21.5 A21.5,21.5 180 1 1 21.5,0Z"/>
                        <Setter Property="Padding" Value="2,1"/>
                        <Setter Property="Width" Value="75"/>
                        <Setter Property="Height" Value="43"/>
                        <Setter Property="Canvas.Top" Value="128"/>
                        <Setter Property="ContentTemplate">
                            <Setter.Value>
                                <DataTemplate>
                                    <Canvas DataContext="{Binding Pokemon}">
                                        <Rectangle RadiusX="5" RadiusY="5" Fill="#80000000" Width="100" Height="24" Canvas.Left="-15" Canvas.Top="-12"/>
                                        <TextBlock Text="{Binding Name}" FontSize="14" Foreground="#ffffff" Width="100" Canvas.Left="-15" Canvas.Top="-9"/>
                                        <ContentPresenter Content="{Binding Gender}" ContentTemplate="{x:Static ui:Labels.Gender}" Canvas.Left="58" Canvas.Top="13"/>
                                        <Image Source="{Binding Converter={x:Static c:SimPokemonIcon.C}}" Height="30" Width="40" SnapsToDevicePixels="True" Canvas.Bottom="3" Canvas.Right="18"/>
                                    </Canvas>
                                </DataTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                    <Style TargetType="Line">
                        <Setter Property="Stroke" Value="#d9f976"/>
                        <Setter Property="StrokeThickness" Value="10"/>
                        <Setter Property="IsHitTestVisible" Value="False"/>
                    </Style>
                    <Style TargetType="Rectangle">
                        <Setter Property="RadiusX" Value="25"/>
                        <Setter Property="RadiusY" Value="25"/>
                        <Setter Property="Fill" Value="#d9f976"/>
                        <Setter Property="Width" Value="81"/>
                        <Setter Property="Height" Value="49"/>
                        <Setter Property="IsHitTestVisible" Value="False"/>
                    </Style>
                </Canvas.Resources>
                <Canvas.Background>
                    <ImageBrush ImageSource="/PBO;component/images/ControlPanel/Fight/Background.png"/>
                </Canvas.Background>
                <Line Visibility="{Binding VO1O0}" X1="119" Y1="75" X2="204" Y2="75"/>
                <Line Visibility="{Binding V01}" X1="119" Y1="150" X2="204" Y2="150"/>
                <Line Visibility="{Binding V0O1}" X1="82" Y1="96" X2="82" Y2="128"/>
                <Line Visibility="{Binding V1O0}" X1="242" Y1="96" X2="242" Y2="128"/>
                <Rectangle Visibility="{Binding VO1}" Canvas.Left="41" Canvas.Top="50"/>
                <Rectangle Visibility="{Binding VO0}" Canvas.Left="201" Canvas.Top="50"/>
                <Rectangle Visibility="{Binding V0}" Canvas.Left="41" Canvas.Top="125"/>
                <Rectangle Visibility="{Binding V1}" Canvas.Left="201" Canvas.Top="125"/>
                <b:GameButton Style="{StaticResource ReturnButton}"/>
                <b:GameButton x:Name="tO1" IsPressedChanged="Target_IsPressedChanged" Content="{Binding PO1}" IsHitTestVisible="{Binding PO1.IsEnabled}" Style="{StaticResource O}" Canvas.Left="44"/>
                <b:GameButton x:Name="tO0" IsPressedChanged="Target_IsPressedChanged" Content="{Binding PO0}" IsHitTestVisible="{Binding PO0.IsEnabled}" Style="{StaticResource O}" Canvas.Left="204"/>
                <b:GameButton x:Name="t0" IsPressedChanged="Target_IsPressedChanged" Content="{Binding P0}" IsHitTestVisible="{Binding P0.IsEnabled}" Style="{StaticResource T}" Canvas.Left="44"/>
                <b:GameButton x:Name="t1" IsPressedChanged="Target_IsPressedChanged" Content="{Binding P1}" IsHitTestVisible="{Binding P1.IsEnabled}" Style="{StaticResource T}" Canvas.Left="204"/>
            </Canvas>
        </TabItem>
        <TabItem>
            <Canvas>
                <Canvas.Background>
                    <ImageBrush ImageSource="/PBO;component/images/ControlPanel/Background.png"/>
                </Canvas.Background>
                <Border Background="#80000000" BorderThickness="2" CornerRadius="12" Canvas.Left="-15" Canvas.Top="204" Width="272" Height="24">
                    <Border.Effect>
                        <BlurEffect/>
                    </Border.Effect>
                </Border>
                <TextBlock Text="点击一次预览 再次点击交换" Foreground="#f8f8f8" Margin="5,208,0,0"/>
                <b:GameButton IsEnabled="{Binding IsReturnEnabled}" Style="{StaticResource ReturnButton}"/>
                <b:GameButton x:Name="pl" Content="{Binding Pokemons[0]}" Canvas.Top="3">
                    <b:GameButton.Resources>
                        <Style x:Key="L" TargetType="b:GameButton">
                            <EventSetter Event="Click" Handler="Pokemon_Click"/>
                            <Setter Property="Width" Value="160"/>
                            <Setter Property="Height" Value="54"/>
                            <Setter Property="Image" Value="/PBO;component/images/ControlPanel/Pokemon/Button.png"/>
                            <Setter Property="Shape" Value="M0,0 H135 A25,25 180 1 1 135,50 H0 Z"/>
                            <Setter Property="Padding" Value="0,1,1,1"/>
                            <Setter Property="ContentTemplate">
                                <Setter.Value>
                                    <DataTemplate>
                                        <Canvas UseLayoutRounding="True">
                                            <Canvas.Resources>
                                                <Style TargetType="Label" BasedOn="{x:Static ui:Controls.STextBlock}">
                                                    <Setter Property="FontWeight" Value="Bold"/>
                                                    <Setter Property="Canvas.Top" Value="36"/>
                                                </Style>
                                            </Canvas.Resources>
                                            <Image Source="{Binding Converter={x:Static c:SimPokemonIcon.C}}" Height="30" Width="40" SnapsToDevicePixels="True" Canvas.Left="-1" Canvas.Top="4"/>
                                            <Image Name="item" Stretch="Uniform" Source="/PBO;component/images/Item.png" Width="8" Height="10" Canvas.Left="28" Canvas.Top="26" SnapsToDevicePixels="True" />
                                            <TextBlock Text="{Binding Name}" Foreground="Black" FontSize="14" Width="54" Canvas.Left="39" Canvas.Top="9"/>
                                            <ContentPresenter Content="{Binding Gender}" ContentTemplate="{x:Static ui:Labels.Gender}" Canvas.Left="139" Canvas.Top="9"/>
                                            <b:LifeBarSimplified DataContext="{Binding Hp}" Canvas.Left="56" Canvas.Top="27"/>
                                            <ContentControl Content="{Binding State}" ContentTemplate="{x:Static ui:Labels.PokemonState}" Canvas.Left="11" Canvas.Top="38"/>
                                            <Label Name="lvt" Content="Lv." Visibility="Collapsed" Canvas.Left="10"/>
                                            <Label Name="lv" Content="{Binding Lv}" Visibility="Collapsed" Canvas.Left="27"/>
                                            <Label Content="{Binding Hp.Value}" Canvas.Right="67"/>
                                            <Label Content="/" Canvas.Left="97"/>
                                            <Label Content="{Binding Hp.Origin}" Canvas.Left="107"/>
                                        </Canvas>
                                        <DataTemplate.Triggers>
                                            <DataTrigger Binding="{Binding State}" Value="Normal">
                                                <Setter TargetName="lvt" Property="Visibility" Value="Visible"/>
                                                <Setter TargetName="lv" Property="Visibility" Value="Visible"/>
                                            </DataTrigger>
                                            <DataTrigger Binding="{Binding Item}" Value="0">
                                                <Setter TargetName="item" Property="Visibility" Value="Collapsed"/>
                                            </DataTrigger>
                                        </DataTemplate.Triggers>
                                    </DataTemplate>
                                </Setter.Value>
                            </Setter>
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding Content.Hp.Value,RelativeSource={RelativeSource Self}}" Value="0">
                                    <Setter Property="Image" Value="/PBO;component/images/ControlPanel/Pokemon/FaintButton.png"/>
                                </DataTrigger>
                                <Trigger Property="Content" Value="{x:Null}">
                                    <Setter Property="IsEnabled" Value="False"/>
                                    <Setter Property="ContentTemplate" Value="{x:Null}"/>
                                </Trigger>
                            </Style.Triggers>
                        </Style>
                        <Style x:Key="PL" TargetType="b:GameButton" BasedOn="{StaticResource L}">
                            <Setter Property="Image" Value="/PBO;component/images/ControlPanel/Pokemon/Partner.png"/>
                        </Style>
                    </b:GameButton.Resources>
                </b:GameButton>
                <b:GameButton x:Name="pr" Content="{Binding Pokemons[1]}" Canvas.Top="8">
                    <b:GameButton.Resources>
                        <Style x:Key="R" TargetType="b:GameButton">
                            <EventSetter Event="Click" Handler="Pokemon_Click"/>
                            <Setter Property="Canvas.Right" Value="0"/>
                            <Setter Property="Padding" Value="1,1,0,1"/>
                            <Setter Property="Width" Value="160"/>
                            <Setter Property="Height" Value="54"/>
                            <Setter Property="Image" Value="/PBO;component/images/ControlPanel/Pokemon/Button.png"/>
                            <Setter Property="Shape" Value="M0,0 H135 A25,25 180 1 1 135,50 H0 Z"/>
                            <Setter Property="HorizontalFlip" Value="True"/>
                            <Setter Property="ContentTemplate">
                                <Setter.Value>
                                    <DataTemplate>
                                        <Canvas Margin="8,0,0,0" UseLayoutRounding="True">
                                            <Canvas.Resources>
                                                <Style TargetType="Label" BasedOn="{x:Static ui:Controls.STextBlock}">
                                                    <Setter Property="FontWeight" Value="Bold"/>
                                                    <Setter Property="Canvas.Top" Value="36"/>
                                                </Style>
                                            </Canvas.Resources>
                                            <Image Source="{Binding Converter={x:Static c:SimPokemonIcon.C}}" Height="30" Width="40" SnapsToDevicePixels="True" Canvas.Left="-1" Canvas.Top="6"/>
                                            <Image Name="item" Stretch="Uniform" Source="/PBO;component/images/Item.png" Width="8" Height="10" Canvas.Left="28" Canvas.Top="26" SnapsToDevicePixels="True" />
                                            <TextBlock Text="{Binding Name}" Foreground="Black" FontSize="14" Width="54" Canvas.Left="39" Canvas.Top="9"/>
                                            <ContentPresenter Content="{Binding Gender}" ContentTemplate="{x:Static ui:Labels.Gender}" Canvas.Left="139" Canvas.Top="9"/>
                                            <b:LifeBarSimplified DataContext="{Binding Hp}" Canvas.Left="56" Canvas.Top="27"/>
                                            <ContentControl Content="{Binding State}" ContentTemplate="{x:Static ui:Labels.PokemonState}" Canvas.Left="11" Canvas.Top="38"/>
                                            <Label Name="lvt" Content="Lv." Visibility="Collapsed" Canvas.Left="10"/>
                                            <Label Name="lv" Content="{Binding Lv}" Visibility="Collapsed" Canvas.Left="27"/>
                                            <Label Content="{Binding Hp.Value}" Canvas.Right="57"/>
                                            <Label Content="/" Canvas.Left="97"/>
                                            <Label Content="{Binding Hp.Origin}" Canvas.Left="107"/>
                                        </Canvas>
                                        <DataTemplate.Triggers>
                                            <DataTrigger Binding="{Binding State}" Value="Normal">
                                                <Setter TargetName="lvt" Property="Visibility" Value="Visible"/>
                                                <Setter TargetName="lv" Property="Visibility" Value="Visible"/>
                                            </DataTrigger>
                                            <DataTrigger Binding="{Binding Item}" Value="0">
                                                <Setter TargetName="item" Property="Visibility" Value="Collapsed"/>
                                            </DataTrigger>
                                        </DataTemplate.Triggers>
                                    </DataTemplate>
                                </Setter.Value>
                            </Setter>
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding Content.Hp.Value,RelativeSource={RelativeSource Self}}" Value="0">
                                    <Setter Property="Image" Value="/PBO;component/images/ControlPanel/Pokemon/FaintButton.png"/>
                                </DataTrigger>
                                <Trigger Property="Content" Value="{x:Null}">
                                    <Setter Property="IsEnabled" Value="False"/>
                                    <Setter Property="ContentTemplate" Value="{x:Null}"/>
                                </Trigger>
                            </Style.Triggers>
                        </Style>
                        <Style x:Key="PR" TargetType="b:GameButton" BasedOn="{StaticResource R}">
                            <Setter Property="Image" Value="/PBO;component/images/ControlPanel/Pokemon/Partner.png"/>
                        </Style>
                    </b:GameButton.Resources>
                </b:GameButton>
                <b:GameButton Content="{Binding Pokemons[2]}" Style="{Binding Style,ElementName=pl}" Canvas.Top="63"/>
                <b:GameButton Content="{Binding Pokemons[3]}" Style="{Binding Style,ElementName=pr}" Canvas.Top="68"/>
                <b:GameButton Content="{Binding Pokemons[4]}" Style="{Binding Style,ElementName=pl}" Canvas.Top="123"/>
                <b:GameButton Content="{Binding Pokemons[5]}" Style="{Binding Style,ElementName=pr}" Canvas.Top="128"/>
            </Canvas>
        </TabItem>
        <TabItem>
            <Grid>
                <Grid.Background>
                    <ImageBrush ImageSource="/PBO;component/images/ControlPanel/Background.png"/>
                </Grid.Background>
                <Grid.Resources>
                    <Style TargetType="b:GameButton">
                        <Setter Property="Shape" Value="M18.5,0 H261.5 A18.5,18.5 180 1 1 261.5,37 H18.5 A18.5,18.5 180 1 1 18.5,0Z"/>
                        <Setter Property="Padding" Value="2,1"/>
                        <Setter Property="Height" Value="37"/>
                        <Setter Property="VerticalAlignment" Value="Top"/>
                        <Setter Property="ContentTemplate">
                            <Setter.Value>
                                <DataTemplate>
                                    <TextBlock Text="{Binding}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                </DataTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </Grid.Resources>
                <Rectangle IsHitTestVisible="False" Height="150" Margin="0,70,0,0" VerticalAlignment="Top">
                    <Rectangle.Fill>
                        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                            <GradientStop Color="#00000000"/>
                            <GradientStop Color="#66000000" Offset="0.05"/>
                            <GradientStop Color="#66000000" Offset="0.95"/>
                            <GradientStop Color="#00000000" Offset="1"/>
                        </LinearGradientBrush>
                    </Rectangle.Fill>
                </Rectangle>
                <b:GameButton Image="/PBO;component/images/ControlPanel/Yes.png" Content="是" Click="GiveUp_Click" Margin="20,90,20,0"/>
                <b:GameButton Image="/PBO;component/images/ControlPanel/No.png" Content="否" Click="Return_Click" Margin="20,160,20,0"/>
            </Grid>
        </TabItem>
    </TabControl>
    <StackPanel x:Name="Time" Orientation="Horizontal" Canvas.Top="-88" Canvas.Right="-35">
        <Label Content="剩余时间：" Style="{x:Static ui:Controls.STextBlock}" FontSize="13"/>
        <Label Content="{Binding Time}" Style="{x:Static ui:Controls.STextBlock}" FontSize="13"/>        
    </StackPanel>
    <ContentControl x:Name="Current" IsHitTestVisible="False" Canvas.Left="320" Canvas.Top="50">
        <ContentControl.ContentTemplate>
            <DataTemplate>
                <Canvas Background="#202020" Height="170" Width="256">
                    <Canvas.Resources>
                        <Style TargetType="TextBlock">
                            <Setter Property="SnapsToDevicePixels" Value="True"/>
                            <Setter Property="Foreground" Value="#e8e8e8"/>
                            <Setter Property="Effect">
                                <Setter.Value>
                                    <DropShadowEffect ShadowDepth="1.2" BlurRadius="2" Color="#B0B0B0"/>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </Canvas.Resources>
                    <Rectangle Width="256" Height="3" Fill="Black"/>
                    <Rectangle Canvas.Top="5" Width="256" Height="22" Fill="Black"/>
                    <Image Source="{Binding Converter={x:Static c:SimPokemonIcon.C}}" Height="30" Width="40"/>
                    <TextBlock Text="{Binding Name}" Canvas.Left="40" Canvas.Top="8" Width="111" />
                    <ContentPresenter Content="{Binding Form.Type1}" ContentTemplate="{x:Static ui:Labels.BattleType}" Width="40" Canvas.Right="3" Canvas.Top="8"/>
                    <ContentPresenter Content="{Binding Form.Type2}" ContentTemplate="{x:Static ui:Labels.BattleType}" Width="40" Canvas.Right="45" Canvas.Top="8"/>
                    <Canvas x:Name="main" Width="256">
                        <Canvas.Resources>
                            <Style TargetType="Line">
                                <Setter Property="SnapsToDevicePixels" Value="True"/>
                                <Setter Property="IsHitTestVisible" Value="False"/>
                                <Setter Property="Stroke" Value="#90a0a8"/>
                            </Style>
                            <Style TargetType="Polyline">
                                <Setter Property="SnapsToDevicePixels" Value="True"/>
                                <Setter Property="Stroke" Value="#98a0a8"/>
                            </Style>
                            <Style TargetType="Label">
                                <Setter Property="SnapsToDevicePixels" Value="True"/>
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="Label">
                                            <Canvas>
                                                <Line X2="4" Y2="4" Stroke="#98a0a8" Canvas.Left="2" Canvas.Top="11.5" SnapsToDevicePixels="True"/>
                                                <Line X1="4" X2="{TemplateBinding Width}" Canvas.Left="2" Canvas.Top="15.5" Stroke="#98a0a8" SnapsToDevicePixels="True"/>
                                                <Rectangle Width="3" Height="3" Fill="#88d018" Canvas.Top="6">
                                                    <Rectangle.Effect>
                                                        <DropShadowEffect BlurRadius="1" ShadowDepth="1.5" Color="#9988d018" Direction="225"/>
                                                    </Rectangle.Effect>
                                                </Rectangle>
                                                <TextBlock Text="{TemplateBinding Content}" Canvas.Left="8" Foreground="#e8e8e8">
                                                    <TextBlock.Effect>
                                                        <DropShadowEffect ShadowDepth="1.2" BlurRadius="2" Color="#B0B0B0"/>
                                                    </TextBlock.Effect>
                                                </TextBlock>
                                            </Canvas>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </Canvas.Resources>
                        <Polygon Points="0,31 182,31 187,24 256,24 255,118 0,118">
                        </Polygon>
                        <Polyline Points="0,30 181,30 186,23 256,23" Stroke="#505860"/>
                        <Polyline Points="0,32 183,32 188,25 256,25" Stroke="#505860"/>
                        <Polyline Points="0,31 182,31 187,24 256,24"/>
                        <Line X2="256" Canvas.Top="118" Stroke="#505860"/>
                        <Line X2="256" Canvas.Top="119"/>
                        <Line X2="256" Canvas.Top="120" Stroke="Black"/>
                        <Polyline Points="12,78 16,81 151,81"/>
                        <Line X1="8" X2="151" Canvas.Top="105"/>

                        <Canvas x:Name="labels">
                            <Label Content="攻击" Width="92" Canvas.Left="162" Canvas.Top="33"/>
                            <Label Content="防御" Width="92" Canvas.Left="162" Canvas.Top="49"/>
                            <Label Content="特攻" Width="92" Canvas.Left="162" Canvas.Top="65"/>
                            <Label Content="特防" Width="92" Canvas.Left="162" Canvas.Top="81"/>
                            <Label Content="速度" Width="92" Canvas.Left="162" Canvas.Top="97"/>
                        </Canvas>

                        <Label Content="{Binding Ability,Converter={x:Static c:AbilityString.C}}" Width="146" Canvas.Left="2" Canvas.Top="33"/>
                        <TextBlock Text="{Binding Ability,Converter={x:Static c:AbilityDString.C}}" TextWrapping="Wrap" Canvas.Left="18" Canvas.Top="49" Height="32" Width="133"/>
                        <Image x:Name="itemImage" Source="/PBO;component/images/Item.png" Width="6" Height="9" Canvas.Left="13" Canvas.Top="95"/>
                        <TextBlock x:Name="itemText" Text="{Binding Item,Converter={x:Static c:ItemString.C}}" Canvas.Left="36" Canvas.Top="89" />
                        <TextBlock Text="{Binding FiveD.Atk}" Canvas.Right="9" Canvas.Top="33"/>
                        <TextBlock Text="{Binding FiveD.Def}" Canvas.Right="9" Canvas.Top="49"/>
                        <TextBlock Text="{Binding FiveD.SpAtk}" Canvas.Right="9" Canvas.Top="65"/>
                        <TextBlock Text="{Binding FiveD.SpDef}" Canvas.Right="9" Canvas.Top="81"/>
                        <TextBlock Text="{Binding FiveD.Speed}" Canvas.Right="9" Canvas.Top="97"/>
                    </Canvas>
                    <Canvas DataContext="{Binding Moves}"  Width="256" Canvas.Top="118">
                        <Canvas.Resources>
                            <Style TargetType="ContentControl">
                                <Setter Property="ContentTemplate">
                                    <Setter.Value>
                                        <DataTemplate>
                                            <Canvas Width="106" ToolTip="{Binding Type}">
                                                <Canvas.Resources>
                                                    <Style TargetType="TextBlock">
                                                        <Setter Property="Foreground" Value="White"/>
                                                        <Setter Property="IsHitTestVisible" Value="False"/>
                                                    </Style>
                                                    <Style TargetType="ToolTip">
                                                        <Setter Property="Background" Value="Black"/>
                                                        <Setter Property="ContentTemplate">
                                                            <Setter.Value>
                                                                <DataTemplate>
                                                                    <Grid>
                                                                        <Grid.Resources>
                                                                            <Style TargetType="TextBlock">
                                                                                <Setter Property="FontFamily" Value="Microsoft YaHei"/>
                                                                                <Setter Property="Foreground" Value="#a0a0a0"/>
                                                                            </Style>
                                                                        </Grid.Resources>
                                                                        <Grid.RowDefinitions>
                                                                            <RowDefinition Height="Auto"/>
                                                                            <RowDefinition Height="Auto"/>
                                                                            <RowDefinition Height="Auto"/>
                                                                        </Grid.RowDefinitions>
                                                                        <Grid.ColumnDefinitions>
                                                                            <ColumnDefinition Width="Auto"/>
                                                                            <ColumnDefinition Width="*"/>
                                                                            <ColumnDefinition Width="Auto"/>
                                                                            <ColumnDefinition Width="*"/>
                                                                        </Grid.ColumnDefinitions>
                                                                        <TextBlock Text="属性："/>
                                                                        <TextBlock Text="{Binding Type}" Grid.Column="1"/>
                                                                        <TextBlock Text="分类：" Grid.Row="1"/>
                                                                        <TextBlock Text="{Binding Category}" Grid.Column="1" Grid.Row="1"/>
                                                                        <TextBlock Text="威力：" Grid.Column="2"/>
                                                                        <TextBlock Text="{Binding Power,Converter={x:Static c:PowerString.C}}" Grid.Column="3"/>
                                                                        <TextBlock Text="命中：" Grid.Row="1" Grid.Column="2"/>
                                                                        <TextBlock Text="{Binding Accuracy,Converter={x:Static c:AccuracyString.C}}" Grid.Column="3" Grid.Row="1"/>
                                                                        <TextBlock Grid.Row="2" Grid.ColumnSpan="4" Text="{Binding Description}" Width="160" TextWrapping="Wrap"/>
                                                                    </Grid>
                                                                </DataTemplate>
                                                            </Setter.Value>
                                                        </Setter>
                                                    </Style>
                                                </Canvas.Resources>
                                                <Polygon DataContext="{Binding Type.Type}" Fill="{Binding Converter={x:Static c:BattleTypeBg.C}}" Stroke="{Binding Converter={x:Static c:BattleTypeBorder.C}}" StrokeThickness="1" Points="0,8 3,0 103,0 106,8 103,16 3,16"/>
                                                <TextBlock Text="/" Canvas.Left="83"/>
                                                <TextBlock Text="{Binding Type.Id,Converter={x:Static c:MoveString.C}}" Canvas.Left="5"/>
                                                <TextBlock Text="{Binding PP.Value}" Canvas.Right="23"/>
                                                <TextBlock Text="{Binding PP.Origin}" Canvas.Left="88"/>
                                            </Canvas>
                                            <DataTemplate.Triggers>
                                                <DataTrigger Binding="{Binding}" Value="{x:Null}">
                                                    <Setter Property="Visibility" Value="Collapsed"/>
                                                </DataTrigger>
                                            </DataTemplate.Triggers>
                                        </DataTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </Canvas.Resources>
                        <ContentControl Content="{Binding [0]}" Canvas.Left="18"/>
                        <ContentControl Content="{Binding [1]}" Canvas.Right="18"/>
                        <ContentControl Content="{Binding [2]}" Canvas.Left="18" Canvas.Top="20"/>
                        <ContentControl Content="{Binding [3]}" Canvas.Right="18" Canvas.Top="20"/>
                    </Canvas>
                </Canvas>
                <DataTemplate.Triggers>
                    <DataTrigger Binding="{Binding}" Value="{x:Null}">
                        <Setter Property="Visibility" Value="Collapsed"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Item}" Value="{x:Null}">
                        <Setter TargetName="itemImage" Property="Visibility" Value="Collapsed"/>
                        <Setter TargetName="itemText" Property="Text" Value="无道具"/>
                    </DataTrigger>
                </DataTemplate.Triggers>
            </DataTemplate>
        </ContentControl.ContentTemplate>
    </ContentControl>
</Canvas>
